package com.hll.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: Mr.Hu
 * @create: 2021-03-12 14:45
 */
@RequestMapping("/HelloController") /*也可以不写类的mapping*/
@Controller
public class HelloController {
  // 真实访问地址 : 项目名/HelloController/hello
  @RequestMapping("/hello")
  public String sayHello(Model model) {
    // 向模型中添加属性msg与值，可以在JSP页面中取出并渲染
    model.addAttribute("msg", "hello,SpringMVC");
    // web-inf/jsp/hello.jsp
    return "hello";
  }
}
